﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;

namespace HYRElectric.WirePlace
{
	internal class CableChannelFilter : ISelectionFilter
	{
		public bool AllowElement(Element ele)
		{
			if (ele.Category.Id.IntegerValue.ToString() == "OST_Wire")
			{
				if (ele.get_Parameter(BuiltInParameter.RBS_ELEC_WIRE_TYPE).AsInteger() == 1)
				{
					return true;
				}
			}
			else
			{
				if (ele.Category.Id.IntegerValue.ToString() == "OST_CableTray")
				{
					return true;
				}
				if (ele.Category.Id.IntegerValue.ToString() == "OST_Lines" && (ele.Location as LocationCurve).Curve as Line != null)
				{
					return true;
				}
			}
			return false;
		}

		public bool AllowReference(Reference refer, XYZ point)
		{
			return false;
		}
	}
}
